package com.workpaper.app.workpaper.daily.view.listener;

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;

import com.workpaper.app.consts.AppConsts;
import com.workpaper.app.utils.platform.SWTPlatformUtils;
import com.workpaper.app.workpaper.daily.business.DailyWorkpaperBusiness;
import com.workpaper.app.workpaper.daily.view.DailyWorkpaperManagerView;

public class DeleteDailyWorkpaperListener implements SelectionListener{

	@Override
	public void widgetSelected(SelectionEvent e) {
		Button btn = (Button) e.widget;
		String id = (String) btn.getData();
		DailyWorkpaperBusiness business = DailyWorkpaperBusiness.getInstance();
		boolean result = business.deleteById(id);
		SWTPlatformUtils.getViewByID(AppConsts.DAILY_WORKPAPER_MANAGE_VIEW, DailyWorkpaperManagerView.class).refreshTableData();;
	}

	@Override
	public void widgetDefaultSelected(SelectionEvent e) {
		// TODO Auto-generated method stub
		
	}
	
}
